<template>
	<view :data-theme="theme">
		<form @submit="formSubmit" report-submit='true'>
			<view class='personal-data borderPad'>
				<view class='list borRadius14'>
					<view class='item acea-row row-between-wrapper'>
						<view>发票单据号</view>
						<view class='input fontColor'>
							<view class="weui-input">{{invoice.closingNo}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>纳税人名称</view>
						<view class='input'>
							<view>{{invoice.cardholder}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>纳税人身份证号</view>
						<view class='input'>
							<view>{{invoice.idCard}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>纳税人手机号</view>
						<view class='input'>
							<view>{{invoice.mobile}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>开户银行</view>
						<view class='input'>
							<view>{{invoice.bankName}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>银行账户</view>
						<view class='input'>
							<view>{{invoice.bankCardNo}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>开户行地址</view>
						<view class='input'>
							<view>{{invoice.bankAddress}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>开票金额</view>
						<view class='input'>
							<view>￥{{invoice.closingPrice}}</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>开票税率</view>
						<view class='input'>
							<view>1%</view>
						</view>
					</view>

					<view class='item acea-row row-between-wrapper'>
						<view>开票状态</view>
						<view class='input'>
							<view v-if="invoice.invoiceStatus=='0'">未开票</view>
							<view v-if="invoice.invoiceStatus=='1'">开票中</view>
							<view v-if="invoice.invoiceStatus=='2'">已开票</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper'>
						<view>结算状态</view>
						<view class='input'>
							<view v-if="invoice.auditStatus=='0'">待审核</view>
							<view v-if="invoice.auditStatus=='1'">审核通过</view>
							<view v-if="invoice.auditStatus=='2'">审核失败</view>
						</view>
					</view>

					<view class='item acea-row row-between-wrapper' v-if="invoice.auditStatus=='2'">
						<view>失败原因</view>
						<view class='input'>
							{{invoice.refusalReason}}
						</view>
					</view>
					<view class='item acea-row row-between-wrapper input'>
						<!-- <view>备注</view> -->
						<view style="font-size:25rpx;">
							<view>1.开票1%税点，请自行在电子税务APP上自行缴纳</view>
							<view>2.结算提现扣除平台手续费5%（不含个人所得税）</view>
							<view>3.操作视频如下，有疑问致电4009918217</view>
						</view>
					</view>
					<view class='item acea-row row-between-wrapper input'>
						<view class='input' style="font-size: 25rpx;width: 100%;">
							<video id="myVideo" src="https://img.yiqichuang6688.top/czsp.mp4" controls="true" autoplay="false"
								style="width: 100%; height: 300px;"></video>
						</view>
					</view>
				</view>
				<button class='modifyBnt bg_color' formType="submit" v-if="invoice.invoiceStatus=='0'">提交开票申请</button>
			</view>
		</form>
	</view>
</template>

<script>
	// +----------------------------------------------------------------------
	// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
	// +----------------------------------------------------------------------
	// | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
	// +----------------------------------------------------------------------
	// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
	// +----------------------------------------------------------------------
	// | Author: CRMEB Team <admin@crmeb.com>
	// +----------------------------------------------------------------------
	import {
		closingInvoiceApi,
		userClosingInfoApi
	} from '@/api/user.js';
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	import {
		Debounce
	} from '@/utils/validate.js'
	import city from "../static/js/city.js";
	let app = getApp();
	const CACHE_ADDRESS = {};
	export default {
		data() {
			return {
				theme: app.globalData.theme,
				userInfo: null,
				invoice: {},
				id: '',
			};
		},
		computed: {
			...mapGetters(['isLogin']),
		},
		onLoad(option) {
			this.id = option.id
			if (!this.isLogin) {
				toLogin();
			} else {
				this.getUserInfo();
				this.getUserClosingInfo(this.id)
			}
		},
		methods: {
			getUserInfo(data) {
				this.$store.dispatch('USERINFO').then(res => {
					this.userInfo = res;
				});
			},
			/**
			 * 用户开票详情
			 */
			getUserClosingInfo(id) {
				let that = this;
				userClosingInfoApi({ id: id }).then(res => {
					uni.hideLoading();
					this.invoice = res.data;
				}).catch(msg => {
					uni.hideLoading();
					return that.$util.Tips({
						title: msg || '提交失败，请稍后在再试！'
					});
				});

			},

			/**
			 * 提交修改
			 */
			formSubmit() {
				let that = this;
				closingInvoiceApi(this.invoice).then(res => {
					uni.hideLoading();
					return that.$util.Tips({
						title: '已申请,请查看短信操作',
						icon: 'success'
					});
					setTimeout(function() {
						uni.reLaunch({
							url: '/pages/user/index',
						})
					}, 2000);

				}).catch(msg => {
					uni.hideLoading();
					return that.$util.Tips({
						title: msg || '提交失败，请稍后在再试！'
					});
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.fontColor {
		color: #868686;
	}

	.personal-data .wrapper {
		margin: 10rpx 0;
		background-color: #fff;
		padding: 36rpx 30rpx 13rpx 30rpx;
	}

	.personal-data .wrapper .title {
		margin-bottom: 30rpx;
		font-size: 32rpx;
		color: #282828;
	}

	.personal-data .wrapper .wrapList .item {
		width: 690rpx;
		height: 160rpx;
		background-color: #f8f8f8;
		border-radius: 20rpx;
		margin-bottom: 22rpx;
		padding: 0 30rpx;
		position: relative;
		border: 2rpx solid #f8f8f8;
		box-sizing: border-box;
	}

	.personal-data .wrapper .wrapList .item.on {
		border-color: $theme-color;
		border-radius: 20rpx;
		background-image: url("");
		background-size: 100% 100%;
		background-color: #fff9f9;
		background-repeat: no-repeat;
	}

	.personal-data .wrapper .wrapList .item .picTxt {
		width: 445rpx;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue {
		width: 96rpx;
		height: 96rpx;
		position: relative;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue image,
	.pictrue button {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}

	.personal-data .wrapper .wrapList .item .picTxt .pictrue .alter {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		position: absolute;
		bottom: 0;
		right: 0;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text {
		width: 325rpx;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text .name {
		width: 100%;
		font-size: 30rpx;
		color: #282828;
	}

	.personal-data .wrapper .wrapList .item .picTxt .text .phone {
		font-size: 24rpx;
		color: #999;
		margin-top: 10rpx;
	}

	.personal-data .wrapper .wrapList .item .bnt {
		font-size: 24rpx;
		background-color: #fff;
		border-radius: 27rpx;
		width: 140rpx;
		height: 54rpx;
		border: 2rpx solid $theme-color;
	}

	.personal-data .wrapper .wrapList .item .currentBnt {
		position: absolute;
		right: 0;
		top: 0;
		font-size: 26rpx;
		background-color: rgba(233, 51, 35, 0.1);
		width: 140rpx;
		height: 48rpx;
		border-radius: 0 20rpx 0 20rpx;
	}

	.personal-data .list {
		margin-top: 30rpx;
		background-color: #fff;
	}

	.personal-data .list .item {
		border-bottom: 1rpx solid #f2f2f2;
		padding: 24rpx;
		font-size: 32rpx;
		color: #333333;
	}

	.personal-data .list .item .phone {
		width: 160rpx;
		height: 56rpx;
		font-size: 24rpx;
		color: #fff;
		line-height: 56rpx;
		border-radius: 32rpx
	}

	.personal-data .list .item .pictrue {
		width: 80rpx;
		height: 80rpx;
		position: relative;
	}

	.personal-data .list .item .pictrue image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}

	.personal-data .list .item .pictrue .alter {
		width: 30rpx;
		height: 30rpx;
		border-radius: 50%;
		position: absolute;
		bottom: 0;
		right: 0;
	}

	.personal-data .list .item .input {
		width: 415rpx;
		text-align: right;
		color: #666666;
	}

	.personal-data .list .item .input .id {
		width: 365rpx;
	}

	.personal-data .list .item .input .iconfont {
		font-size: 35rpx;
	}

	.personal-data .modifyBnt {
		font-size: 32rpx;
		color: #fff;
		width: 690rpx;
		height: 90rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 90rpx;
		margin: 76rpx auto 0 auto;
	}

	.bg_color {
		@include main_bg_color(theme);
	}

	.personal-data .logOut {
		font-size: 32rpx;
		text-align: center;
		width: 690rpx;
		height: 90rpx;
		border-radius: 45rpx;
		margin: 30rpx auto 0 auto;
	}
</style>